<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Cuentas extends CI_Controller {

    public function __construct() {
        parent::__construct();
        session_start();
        $this->esSuperAdministrador();
        $this->load->model('_cuentam');
    }

    public function index() {
        $data = array();
        $this->loadData($data);
        // var_dump($data['clientes']);
        $this->load->view('admin/templates/header', $data);
        $this->load->view('admin/templates/tabs');
        $this->load->view('admin/cuentasV');
        $this->load->view('admin/templates/footer');
    }

    private function loadData(&$data) {
        $data['tab'] = "cuentas";
        $data['mostrarMenu'] = true;
        $data['cuentas'] = $this->_cuentam->getAll();
    }

    public function crearCuenta() {
        if (!empty($_POST)) {
            $this->escapar($_POST);
            $this->_cuentam->insert($_POST);
        }
        header("Location:../administrarCuentas");
    }

}

